gdk: Replace GTK_USE_PORTAL env var with GDK_DEBUG flag
authorBenjamin Otte <otte@redhat.com>
Fri, 24 Jun 2022 00:15:25 +0000 (02:15 +0200)
committerBenjamin Otte <otte@redhat.com>
Fri, 24 Jun 2022 01:14:50 +0000 (03:14 +0200)
It's a debug flag, so make it clear that it is one.

Related: Clowns on the Arch wiki on
https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications#Consistent_file_dialog

gdk/gdk.c
gdk/gdkdebug.h

index d40c5ee4dfa56f6e5581290d573e958cc30195ff..4d3e4eb5b644dd701ef9aa5df3ee3a7ef09895b3 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -117,6 +117,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
   { "selection",       GDK_DEBUG_SELECTION, "Information about selections" },
   { "clipboard",       GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
   { "nograbs",         GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)" },
+  { "portals",         GDK_DEBUG_PORTALS, "Force the use of portals" },
   { "gl-disable",      GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
   { "gl-software",     GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
   { "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
@@ -360,21 +361,13 @@ gdk_running_in_sandbox (void)
 gboolean
 gdk_should_use_portal (void)
 {
-  static const char *use_portal = NULL;
+  if (GDK_DISPLAY_DEBUG_CHECK (NULL, PORTALS))
+    return TRUE;
 
-  if (G_UNLIKELY (use_portal == NULL))
-    {
-      if (gdk_running_in_sandbox ())
-        use_portal = "1";
-      else
-        {
-          use_portal = g_getenv ("GTK_USE_PORTAL");
-          if (!use_portal)
-            use_portal = "";
-        }
-    }
+  if (gdk_running_in_sandbox ())
+    return TRUE;
 
-  return use_portal[0] == '1';
+  return FALSE;
 }
 
 PangoDirection
index acd2259440a09e90abd9c949bb98c96adc88a0f2..34499edc9539dc5ece032985d4d5715568d165b4 100644 (file)
@@ -38,19 +38,20 @@ typedef enum {
   GDK_DEBUG_CLIPBOARD       = 1 << 10,
   /* flags below are influencing behavior */
   GDK_DEBUG_NOGRABS         = 1 << 11,
-  GDK_DEBUG_GL_DISABLE      = 1 << 12,
-  GDK_DEBUG_GL_SOFTWARE     = 1 << 13,
-  GDK_DEBUG_GL_TEXTURE_RECT = 1 << 14,
-  GDK_DEBUG_GL_LEGACY       = 1 << 15,
-  GDK_DEBUG_GL_GLES         = 1 << 16,
-  GDK_DEBUG_GL_DEBUG        = 1 << 17,
-  GDK_DEBUG_GL_EGL          = 1 << 18,
-  GDK_DEBUG_GL_GLX          = 1 << 19,
-  GDK_DEBUG_GL_WGL          = 1 << 20,
-  GDK_DEBUG_VULKAN_DISABLE  = 1 << 21,
-  GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
-  GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
-  GDK_DEBUG_HIGH_DEPTH      = 1 << 24,
+  GDK_DEBUG_PORTALS         = 1 << 12,
+  GDK_DEBUG_GL_DISABLE      = 1 << 13,
+  GDK_DEBUG_GL_SOFTWARE     = 1 << 14,
+  GDK_DEBUG_GL_TEXTURE_RECT = 1 << 15,
+  GDK_DEBUG_GL_LEGACY       = 1 << 16,
+  GDK_DEBUG_GL_GLES         = 1 << 17,
+  GDK_DEBUG_GL_DEBUG        = 1 << 18,
+  GDK_DEBUG_GL_EGL          = 1 << 19,
+  GDK_DEBUG_GL_GLX          = 1 << 20,
+  GDK_DEBUG_GL_WGL          = 1 << 21,
+  GDK_DEBUG_VULKAN_DISABLE  = 1 << 22,
+  GDK_DEBUG_VULKAN_VALIDATE = 1 << 23,
+  GDK_DEBUG_DEFAULT_SETTINGS= 1 << 24,
+  GDK_DEBUG_HIGH_DEPTH      = 1 << 25,
 } GdkDebugFlags;
 
 extern guint _gdk_debug_flags;